#!/usr/bin/python
import requests
from requests.auth import HTTPBasicAuth
def http_post(url,jstr):
    url= url
    headers = {'Content-Type':'application/json'}
    resp = requests.post(url,jstr,headers=headers,auth=HTTPBasicAuth('admin', 'admin'))
    return resp     
    
if __name__ == "__main__":
    url = 'http://127.0.0.1:8080/stats/flowentry/add'
    with open('hardtimeout_ryu.json') as f:
        jstr = f.read()
    resp = http_post(url,jstr)
    print (resp.text)
